package com.ruoyi.coronary.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.coronary.mapper.CoronaryAppointmentMapper;
import com.ruoyi.coronary.domain.CoronaryAppointment;
import com.ruoyi.coronary.service.ICoronaryAppointmentService;

/**
 * 挂号信息Service业务层处理
 *
 * @author wky
 * @date 2024-04-03
 */
@Service
public class CoronaryAppointmentServiceImpl implements ICoronaryAppointmentService
{
    @Autowired
    private CoronaryAppointmentMapper coronaryAppointmentMapper;

    /**
     * 查询挂号信息
     *
     * @param appointmentId 挂号信息主键
     * @return 挂号信息
     */
    @Override
    public CoronaryAppointment selectCoronaryAppointmentByAppointmentId(Long appointmentId)
    {
        return coronaryAppointmentMapper.selectCoronaryAppointmentByAppointmentId(appointmentId);
    }

    /**
     * 查询挂号信息列表
     *
     * @param coronaryAppointment 挂号信息
     * @return 挂号信息
     */
    @Override
    public List<CoronaryAppointment> selectCoronaryAppointmentList(CoronaryAppointment coronaryAppointment)
    {
        return coronaryAppointmentMapper.selectCoronaryAppointmentList(coronaryAppointment);
    }

    /**
     * 新增挂号信息
     *
     * @param coronaryAppointment 挂号信息
     * @return 结果
     */
    @Override
    public int insertCoronaryAppointment(CoronaryAppointment coronaryAppointment)
    {
        coronaryAppointment.setCreateTime(DateUtils.getNowDate());
        coronaryAppointment.setCreateBy(SecurityUtils.getUsername());
        return coronaryAppointmentMapper.insertCoronaryAppointment(coronaryAppointment);
    }

    /**
     * 修改挂号信息
     *
     * @param coronaryAppointment 挂号信息
     * @return 结果
     */
    @Override
    public int updateCoronaryAppointment(CoronaryAppointment coronaryAppointment)
    {
        coronaryAppointment.setUpdateTime(DateUtils.getNowDate());
        return coronaryAppointmentMapper.updateCoronaryAppointment(coronaryAppointment);
    }

    /**
     * 批量删除挂号信息
     *
     * @param appointmentIds 需要删除的挂号信息主键
     * @return 结果
     */
    @Override
    public int deleteCoronaryAppointmentByAppointmentIds(Long[] appointmentIds)
    {
        return coronaryAppointmentMapper.deleteCoronaryAppointmentByAppointmentIds(appointmentIds);
    }

    /**
     * 删除挂号信息信息
     *
     * @param appointmentId 挂号信息主键
     * @return 结果
     */
    @Override
    public int deleteCoronaryAppointmentByAppointmentId(Long appointmentId)
    {
        return coronaryAppointmentMapper.deleteCoronaryAppointmentByAppointmentId(appointmentId);
    }
}
